Repository navigation
fix(integrations): read bm_schema fields the backend actually returns - #1998
Merged
Merged
Conversation
The OpenClaw schema_validate, schema_infer and schema_diff tools read entity_type, identifier, valid and declared_in. BM's ValidationReport, InferenceReport and DriftReport send note_type, note_identifier and passed, and have no declared_in. The client casts the payload without translating fields, so every validated note rendered as "**undefined** — invalid", type headings read "undefined", and dropped fields read "declared in undefined". - Align SchemaValidationResult, SchemaInferResult and SchemaDiffResult with the backend models in src/basic_memory/schemas/schema.py. - Render notes by note_identifier and passed, and type headings by note_type. - Describe a dropped field by its source and frequency, as BM's own drift report does, and label the section "rare in notes": a dropped field can still appear in a few notes. The unit fixtures used the same stale field names, so they passed. They now follow the backend models and assert exact rendered lines. A new integration test runs all three tools against a real bm mcp. Fixes #1997 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Drew Cain <groksrc@gmail.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1997. With this fix, the OpenClaw plugin's
schema_validate,schema_inferandschema_difftools show the backend's real results. Before, a note that passed validation was shown to the agent as**undefined** — invalid.The bug
The plugin read field names that
bm_schemanever returns. The client casts the JSON payload to its declared types without translating anything, so TypeScript couldn't catch the mismatch.src/basic_memory/schemas/schema.py)entity_typenote_type**Type:** undefinedidentifiernote_identifier**undefined**validpassedinvaliddeclared_indeclared in undefinedThe unit test fixtures used the same wrong names, so CI passed.
What changes
bm-client.ts:SchemaValidationResult,SchemaInferResultandSchemaDiffResultnow mirror the backend'sValidationReport,InferenceReportandDriftReport. With the corrected types,tscflagged every stale read.tools/schema-validate.ts: notes render bynote_identifier, with valid or invalid taken frompassed.passedstays true when a note has only warnings, so a warn-mode note shows as valid and lists its warnings.tools/schema-infer.ts,tools/schema-diff.ts: type headings usenote_type.**fax** (observation) — 10% (1/10). The section is now titled "rare in notes", because a dropped field can still appear in a few notes.Missing schemas and empty note types are unaffected. Since 1.0, BM reports them as
NOT_FOUNDtool errors, and each tool's existing error handling already shows those.Regression tests
tools/schema-*.test.ts): fixtures are rebuilt from the backend models, and assertions check exact rendered lines.note_type.integration/bm-client.integration.test.ts): writes acontactschema in warn mode and two notes, then runs all three tools against a realbm mcp.note_type,note_identifierandpassed.undefined.Run against
main's source (77f40181), four unit tests and the integration test fail. All pass with this change.Verification
just package-check-openclaw: exit 0, 286 tests pass.bun run test:intagainst a realbm mcpfrom this checkout: 6 pass, 0 fail.main's plugin source against a realbm1.0.0 project. All three tools renderedundefined, matching the report.🤖 Generated with Claude Code